package com.gitee.mqttclient.client;

import java.util.Objects;

/**
 * topic信息
 * @author thc
 */
public class TopicInfo {

    /**
     * 主题
     */
    private final String topic;

    /**
     * QOS
     */
    private final int qos;

    public TopicInfo(String topic, int qos) {
        this.topic = topic;
        this.qos = qos;
    }

    public int getQos() {
        return qos;
    }

    public String getTopic() {
        return topic;
    }

    @Override
    public String toString() {
        return "TopicInfo{" +
                "topic='" + topic + '\'' +
                ", qos=" + qos +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TopicInfo topicInfo = (TopicInfo) o;
        return Objects.equals(topic, topicInfo.topic);
    }

    @Override
    public int hashCode() {
        return Objects.hash(topic);
    }
}